<%@ Page Language="VB" AutoEventWireup="false" 
    CodeFile="CommisionDetails.aspx.vb" 
    Inherits="Accounting_CommisionDetails"
    MasterPageFile="~/MasterPage.master" %>
    
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div id="divMain" runat="server">
        <script language="javascript" type="text/javascript">
            function setAmount () {
                var rate = document.getElementById('<%=Rate_txt.ClientID%>');
                var amt = document.getElementById('<%=Plan_txt.ClientID%>');
                var comm = document.getElementById('<%=Amount_txt.ClientID%>');
                
                var tamt = removeCommas(amt.value);
                
                comm.value = tamt * (rate.value *0.01);
                comm.value = addCommas(comm.value);
                
                var CommAmount = document.getElementById('<%=CommAmount_txt.ClientID%>');
                var orig_amt = document.getElementById('<%=Amount_txt.ClientID%>');
                var conv_rate = document.getElementById('<%=ConversionRate_txt.ClientID%>');
                
                var t_orig_amt = removeCommas(orig_amt.value);
                var t_conv_rate = removeCommas(conv_rate.value);
                
                CommAmount.value = t_orig_amt * t_conv_rate;
                CommAmount.value = addCommas(CommAmount.value);
            }
            
            function setRate () {
                var rate = document.getElementById('<%=Rate_txt.ClientID%>');
                var amt = document.getElementById('<%=Plan_txt.ClientID%>');
                var comm = document.getElementById('<%=Amount_txt.ClientID%>');
                
                var tamt = removeCommas(amt.value);
                var tcomm = removeCommas(comm.value);
                
                rate.value = tcomm/tamt * 100;
                
                var CommAmount = document.getElementById('<%=CommAmount_txt.ClientID%>');
                var orig_amt = document.getElementById('<%=Amount_txt.ClientID%>');
                var conv_rate = document.getElementById('<%=ConversionRate_txt.ClientID%>');
                
                var t_orig_amt = removeCommas(orig_amt.value);
                var t_conv_rate = removeCommas(conv_rate.value);
                
                CommAmount.value = t_orig_amt * t_conv_rate;
                CommAmount.value = addCommas(CommAmount.value);
            }
            
            function setRecAmt () {
                var rate = document.getElementById('<%=RecievableRate_txt.ClientID%>');
                var amt = document.getElementById('<%=Plan_txt.ClientID%>');
                var comm = document.getElementById('<%=RecievableAmt_txt.ClientID%>');
                
                var tamt = removeCommas(amt.value);
                
                comm.value = tamt * (rate.value *0.01);
                comm.value = addCommas(comm.value);
            }
            
            function setRecRate () {
                var rate = document.getElementById('<%=RecievableRate_txt.ClientID%>');
                var amt = document.getElementById('<%=Plan_txt.ClientID%>');
                var comm = document.getElementById('<%=RecievableAmt_txt.ClientID%>');
                
                var tamt = removeCommas(amt.value);
                var tcomm = removeCommas(comm.value);
                
                rate.value = tcomm/tamt * 100;
               
            }
            
            function setConvAmt () {
                var CommAmount = document.getElementById('<%=CommAmount_txt.ClientID%>');
                var orig_amt = document.getElementById('<%=Amount_txt.ClientID%>');
                var conv_rate = document.getElementById('<%=ConversionRate_txt.ClientID%>');
                
                var t_orig_amt = removeCommas(orig_amt.value);
                var t_conv_rate = removeCommas(conv_rate.value);
                
                CommAmount.value = t_orig_amt * t_conv_rate;
                CommAmount.value = addCommas(CommAmount.value);
            }
        </script>
    
        <table border="0" cellpadding="0" cellspacing="0" width="800">
            <tr>
            <td align="center" style="font-weight: bold; font-size: 10pt; font-family: Arial">
                </td>
            <td style="font-size: 11pt; font-family: Arial; font-weight: bold;" align="center">
                </td>
            <td align="center" style="font-weight: bold; font-size: 10pt; font-family: Arial">
                </td>
            <td style="font-size: 11pt; font-family: Arial; font-weight: bold;" align="center">
                </td>
            <td align="center" style="font-weight: bold; font-size: 10pt; font-family: Arial; width: 5px;">
                </td>
            <td style="font-size: 11pt; font-family: Arial; font-weight: bold;" align="center">
                </td>
            <td align="center" style="font-weight: bold; font-size: 10pt; font-family: Arial; width: 137px;">
                </td>
            <td align="left" style="font-weight: bold; font-size: 10pt; font-family: Arial; width: 368px; text-align: right;"></td>
            </tr>
        </table>
    

        <table border="0" cellpadding="0" cellspacing="0" width="800">
            <tr><td style="font-size: 3px; background-color: #105BA4; height: 3px;"></td></tr>
        </table>

        <table border="0" cellpadding="0" cellspacing="0" width="800">
                
        <tr><td style="width: 800px">

            <table border="0" cellpadding="0" cellspacing="0" width="800" style="height: 35px">
                <tr>
                    <td style="font-size: 10pt; font-family: Verdana; width: 140px;" align="left" valign="middle">
                        &nbsp;AR Number:</td>
                    <td align="left" style="width: 260px" valign="middle">
                        <asp:TextBox ID="PaymentNo_txt" runat="server" Width="232px" Enabled="False"></asp:TextBox></td>
                    <td style="font-size: 10pt; font-family: Verdana; width: 100px;" align="left" valign="middle">
                        Policy Year:</td>
                    <td align="left" style="width: 300px" valign="middle">
                        <asp:Label ID="lblPolicyYear" runat="server"></asp:Label></td>
                </tr>
            </table>
                
        </td></tr>
        
        <tr><td style="width: 800px">

            <table border="0" cellpadding="0" cellspacing="0" width="800" style="height: 35px">
                <tr>
                    <td style="font-size: 10pt; font-family: Verdana; width: 140px; vertical-align: top; height: 40px;" align="left">
                        &nbsp;AR Date:</td>
                    <td align="left" style="width: 260px; height: 40px;" valign="top">
                        <asp:TextBox ID="ARDT_txt" runat="server" Width="232px" Enabled="False"></asp:TextBox><asp:Label ID="Label1" runat="server" Font-Names="Verdana" Font-Overline="False"
                            Font-Size="7pt" ForeColor="Gray" Text="dd/mm/yyyy" Width="64px"></asp:Label></td>
                    <td style="font-size: 10pt; font-family: Verdana; width: 100px; height: 40px;" align="left" valign="top">
                        Due Date:</td>
                    <td align="left" style="width: 300px; height: 40px;" valign="top">
                        <asp:TextBox ID="DueDT_txt" runat="server" Width="232px" Enabled="False"></asp:TextBox><asp:Label ID="Label3" runat="server" Font-Names="Verdana" Font-Overline="False"
                            Font-Size="7pt" ForeColor="Gray" Text="dd/mm/yyyy" Width="64px"></asp:Label></td>
                </tr>
            </table>
                
        </td></tr>

        <tr><td style="width: 800px">

            <table border="0" cellpadding="0" cellspacing="0" width="800" style="height: 35px">
                <tr>
                    <td style="font-size: 10pt; font-family: Verdana; width: 140px;" align="left" valign="top">
                        &nbsp;Policy Number:</td>
                    <td align="left" style="width: 260px" valign="top">
                        <asp:TextBox ID="PolicyNo_txt" runat="server" Enabled="False" Width="232px"></asp:TextBox></td>
                    <td style="font-size: 10pt; font-family: Verdana; width: 100px;" align="left" valign="top">
                        Payment Date:</td>
                    <td align="left" style="width: 300px" valign="top">
                        <asp:TextBox ID="PaymentDT_txt" runat="server" Width="232px"></asp:TextBox><asp:Label ID="Label2" runat="server" Font-Names="Verdana" Font-Overline="False"
                            Font-Size="7pt" ForeColor="Gray" Text="dd/mm/yyyy" Width="64px"></asp:Label></td>
                </tr>
            </table>
                
        </td></tr>

        <tr><td style="width: 800px; height: 54px;">

            <table border="0" cellpadding="0" cellspacing="0" width="800" style="height: 35px">
                <tr>
                    <td style="font-size: 10pt; font-family: Verdana; width: 140px;" align="left">
                        &nbsp;Introducer:</td>
                    <td align="left" style="width: 260px"><asp:DropDownList ID="Advisor_cmb" runat="server" Width="240px">
                    </asp:DropDownList></td>
                    <td style="font-size: 10pt; font-family: Verdana; width: 100px;" align="left">
                        </td>
                    <td align="left" style="width: 300px">
                        </td>
                </tr>
            </table>
                
        </td></tr>

        <tr><td style="width: 800px">

            <table border="0" cellpadding="0" cellspacing="0" width="800" style="height: 35px">
                <tr>
                    <td style="font-size: 10pt; font-family: Verdana; width: 140px;" align="left">
                        &nbsp;Provider:</td>
                    <td align="left" style="width: 260px">
                        <asp:TextBox ID="Provider_txt" runat="server" Width="232px" Enabled="False"></asp:TextBox></td>
                    <td style="font-size: 10pt; font-family: Verdana; width: 100px;" align="left">
                        Product:</td>
                    <td align="left" style="width: 300px">
                        <asp:TextBox ID="Product_txt" runat="server" Width="232px" Enabled="False"></asp:TextBox></td>
                </tr>
            </table>
                
        </td></tr>

        <tr><td style="width: 800px">

            <table border="0" cellpadding="0" cellspacing="0" width="800" style="height: 35px">
                <tr>
                    <td style="font-size: 10pt; font-family: Verdana; width: 140px; height: 35px;" align="left">
                        &nbsp;Policy Amount:</td>
                    <td align="left" style="width: 260px; height: 35px;">
                        <asp:TextBox ID="Plan_txt" runat="server" Width="232px" Enabled="False"></asp:TextBox></td>
                    <td style="font-size: 10pt; font-family: Verdana; width: 100px; height: 35px;" align="left">
                        Rate:</td>
                    <td align="left" style="width: 300px; height: 35px;">
                        <asp:TextBox ID="Rate_txt" runat="server" Width="48px" MaxLength="5"></asp:TextBox>
                        %</td>
                </tr>
            </table>
                
        </td></tr>
        
        
        <tr><td style="width: 800px">

            <table border="0" cellpadding="0" cellspacing="0" width="800" style="height: 35px">
                <tr>
                    <td style="font-size: 10pt; font-family: Verdana; width: 140px; height: 35px;" align="left">
                        &nbsp;Commision Amount:</td>
                    <td align="left" style="width: 260px; height: 35px;">
                        <asp:TextBox ID="Amount_txt" runat="server" Width="232px"></asp:TextBox></td>
                    <td style="font-size: 10pt; font-family: Verdana; width: 100px; height: 35px;" align="left">
                        Currency:</td>
                    <td align="left" style="width: 300px; height: 35px;">
                        <asp:DropDownList ID="Currency_cmb" runat="server" Width="88px">
                        </asp:DropDownList></td>
                </tr>
            </table>
                
        </td></tr>
        
        <tr><td style="width: 800px">

            <table border="0" cellpadding="0" cellspacing="0" width="800" style="height: 35px">
                <tr>
                    <td style="font-size: 10pt; font-family: Verdana; width: 140px; height: 35px;" align="left">
                        &nbsp;Converted Amount:</td>
                    <td align="left" style="width: 260px; height: 35px;">
                        <asp:TextBox ID="CommAmount_txt" runat="server" Width="232px"></asp:TextBox></td>
                    <td style="font-size: 10pt; font-family: Verdana; width: 100px; height: 35px;" align="left">
                        Currency:</td>
                    <td align="left" style="width: 100px; height: 35px;">
                        <asp:DropDownList ID="ConvertCurrency_cmb" runat="server" Width="88px">
                        </asp:DropDownList></td>
                    <td align="left" style="width: 120px; height: 35px; font-size: 10pt; font-family: Tahoma;">
                        &nbsp; Conversion Rate:</td>
                    <td align="left" style="width: 80px; height: 35px;">
                        <asp:TextBox ID="ConversionRate_txt" runat="server" Width="64px"></asp:TextBox></td>
                </tr>
            </table>
                
        </td></tr>

        <tr><td style="width: 800px">

            <table border="0" cellpadding="0" cellspacing="0" width="800" style="height: 35px">
                <tr>
                    <td style="font-size: 10pt; font-family: Verdana; width: 140px; height: 35px;" align="left">
                        &nbsp;Receivable Amount:</td>
                    <td align="left" style="width: 260px; height: 35px;">
                        <asp:TextBox ID="RecievableAmt_txt" runat="server" Width="232px"></asp:TextBox></td>
                    <td style="font-size: 10pt; font-family: Verdana; width: 100px; height: 35px;" align="left">
                        Rate:</td>
                    <td align="left" style="width: 300px; height: 35px;">
                        <asp:TextBox ID="RecievableRate_txt" runat="server" Width="48px" MaxLength="5"></asp:TextBox>
                        %</td>
                </tr>
            </table>
                
        </td></tr>
        
        <tr><td style="width: 800px">

            <table border="0" cellpadding="0" cellspacing="0" width="800" style="height: 35px">
                <tr>
                    <td style="font-size: 10pt; font-family: Verdana; width: 140px;" align="left">
                        &nbsp;Commision Type:</td>
                    <td align="left" style="width: 260px">
                        <asp:DropDownList ID="CommType_cmb" runat="server" Width="240px">
                        </asp:DropDownList></td>
                    <td style="font-size: 10pt; font-family: Verdana; width: 100px;" align="left">
                        Status:</td>
                    <td align="left" style="width: 300px"><asp:DropDownList ID="CommStatus_cmb" runat="server" Width="240px">
                    </asp:DropDownList></td>
                </tr>
            </table>
                
        </td></tr>
        <tr><td style="width: 800px; height: 54px;">

            <table border="0" cellpadding="0" cellspacing="0" width="800" style="height: 35px">
                <tr>
                    <td style="width: 400px; height: 24px;">
                        &nbsp;
                        &nbsp;&nbsp;
                    </td>
                    <td style="height: 24px">
                        <asp:Button ID="Save_btn" runat="server" Text="Save" BackColor="Gainsboro" Font-Names="Verdana" Width="72px" />
                    </td>
                    <td style="height: 24px">
                        <asp:Button ID="Cancel_btn" runat="server" Text="Back" BackColor="Gainsboro" Font-Names="Verdana" Width="72px" CausesValidation="False" PostBackUrl="~/Accounting/Commision.aspx" />
                    </td>
                </tr>
            </table>
                
        </td></tr>

        </table>    
    </div>
    <ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender1" runat="server" Mask="99/99/9999"
        MaskType="Date" TargetControlID="DueDT_txt">
    </ajaxToolkit:MaskedEditExtender>
    <ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender2" runat="server" Mask="99/99/9999"
        MaskType="Date" TargetControlID="PaymentDT_txt">
    </ajaxToolkit:MaskedEditExtender><ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender3" runat="server" Mask="99/99/9999"
        MaskType="Date" TargetControlID="ARDT_txt">
    </ajaxToolkit:MaskedEditExtender>
    <asp:CustomValidator ID="dtv1" runat="server" ClientValidationFunction="valDate"
        ControlToValidate="PaymentDT_txt" ErrorMessage="Invalid Payment Date" ForeColor="White"
        ValidateEmptyText="True">.</asp:CustomValidator>
    <asp:RequiredFieldValidator ID="rfv1" runat="server" ControlToValidate="Rate_txt"
        ErrorMessage="Rate Required" ForeColor="White" Text="."></asp:RequiredFieldValidator>
    <asp:RequiredFieldValidator ID="rfv2" runat="server" ControlToValidate="Amount_txt"
        ErrorMessage="Commision Amount Required" ForeColor="White" Text="."></asp:RequiredFieldValidator>
    &nbsp;<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
        ShowSummary="False" />
    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server"
        TargetControlID="rfv1">
    </ajaxToolkit:ValidatorCalloutExtender>
    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server"
        TargetControlID="rfv2">
    </ajaxToolkit:ValidatorCalloutExtender>
    <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender3" runat="server"
        TargetControlID="dtv1">
    </ajaxToolkit:ValidatorCalloutExtender>
    <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server"
        FilterType="Custom, Numbers" TargetControlID="Amount_txt" ValidChars=".">
    </ajaxToolkit:FilteredTextBoxExtender>
    <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" runat="server"
        FilterType="Custom, Numbers" TargetControlID="Rate_txt" ValidChars=".">
    </ajaxToolkit:FilteredTextBoxExtender><ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server"
        FilterType="Custom, Numbers" TargetControlID="RecievableAmt_txt" ValidChars=".">
    </ajaxToolkit:FilteredTextBoxExtender>
    <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server"
        FilterType="Custom, Numbers" TargetControlID="RecievableRate_txt" ValidChars=".">
    </ajaxToolkit:FilteredTextBoxExtender>
</asp:Content>